import fetch from 'common/src/utils/fetch';

const SERVICE = '/api/textbookservice';

const COMMITMENT_CONTROLLER = 'commitment';

/**
 * 根据条件，分页(不分页)查询
 * @param {*} data
 */
export function queryCommitmentListByPage(data) {
  return fetch({
    url: `${SERVICE}//${COMMITMENT_CONTROLLER}/listPage`,
    method: 'post',
    data
  });
}

/**
 * 根据教学班id查询教学班教材详情
 * @param {*} classId
 */
export function findTeachingTextbookById(classId) {
  return fetch({
    url: `${SERVICE}/${COMMITMENT_CONTROLLER}/${classId}`,
    method: 'get'
  });
}

/**
 * 下载模板
 */
export function downloadTemplate() {
  return fetch({
    url: `${SERVICE}/${COMMITMENT_CONTROLLER}/template`,
    method: 'GET'
  })
}

/**
 * 承诺书材料管理列表导出
 */
export function exportList(data) {
  return fetch({
    url: `${SERVICE}/${COMMITMENT_CONTROLLER}/exportList`,
    method: 'post',
    showMask: false,
    data
  });
}

/**
 * 上传承诺书材料
 * @param data
 */
export function saveCommitment(data) {
  return fetch({
    url: `${SERVICE}/${COMMITMENT_CONTROLLER}`,
    method: 'put',
    data
  });
}

